package com.powernode.springboot;

import com.powernode.springboot.bean.Vip;
import com.powernode.springboot.service.VipService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.List;

//配置mapper扫描
@MapperScan(basePackages = {"com.powernode.springboot.repository"})
@SpringBootApplication
public class Springboot312MybatisApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Springboot312MybatisApplication.class, args);
        VipService vipService = applicationContext.getBean(VipService.class);
        Vip vip = new Vip(null, "张三", "1234567890", "1994-06-14");
        boolean isSuccess = vipService.save(vip);
        System.out.println(isSuccess);
        List<Vip> vipList = vipService.selectAll();
        vipList.forEach(System.out::println);
        applicationContext.close();
    }

}
